package com.basic.modules.nykf.service.impl;

import com.basic.common.utils.DateUtils;
import com.basic.common.utils.ParamsModel;
import com.basic.modules.nykf.dao.JxKfDao;
import com.basic.modules.nykf.entity.JxKfEntity;
import com.basic.modules.nykf.service.JxKfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

@Service
public class JxKfServiceImpl implements JxKfService {

    @Autowired
    JxKfDao jxKfDao;

    @Override
    public List<JxKfEntity> getKfJxList(JxKfEntity jxKfEntity) {
        String yf = jxKfEntity.getYf();
        Map<String, String> firstAndLastDayOfMonth = DateUtils.getFirstAndLastDayOfMonth(yf);
        String firstDay = firstAndLastDayOfMonth.get("firstDay").toString();
        String lastDay = firstAndLastDayOfMonth.get("lastDay").toString();
        List<JxKfEntity> kfJxList = jxKfDao.getKfJxList(jxKfEntity, firstDay, lastDay);
        for (JxKfEntity kfEntity : kfJxList) {
            kfEntity.setYf(jxKfEntity.getYf());
        }
        return kfJxList;
    }
}